<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .wrap {
      width: 200px;
      height: 300px;
      /* 如果父盒子没有高，高度默认为子盒子每行的最高的那个盒子高度的和，并且没有多余的空间排列，align-content没有效果 */
      border: 2px solid #000;
      display: flex;
      flex-wrap: wrap;
      align-content: center;
      /* align-content: flex-start; */
      /* align-items: center;  对子盒子每一行设置 */
    }
  /* // 每个子盒子都加高  每行是一个整体 */
    .item:nth-child(1){
      width: 50px;
      height: 50px;
      background-color: blue;

    }
    .item:nth-child(2){
      width: 50px;
      height: 100px;
      background-color: pink;
    }
    .item:nth-child(3){
      background-color: red;
      height: 50px;
    }
    .item:nth-child(4){
      background-color: yellow;
      height: 50px;
    }
    .item:nth-child(5){
      width: 50px;
      height: 50px;
      background-color: skyblue;
    }
    .item:nth-child(6){
      background-color: yellow;
      width: 50px;
      height: 100px;
    }
    .item:nth-child(7){
      height: 60px;
      background-color: red;
    }
    /* 单行设置是无效的，需要设置flex-wrap: wrap;允许必要时候换行，并且flex-derection: row
        将一行看成一个整体
     */
  </style>
</head>
<body>
  <div class="wrap">
    <div class="item">1111</div>
    <div class="item">222</div>
    <div class="item">333</div>
    <div class="item">4444</div>
    <div class="item">5555</div>
    <div class="item">666</div>
    <div class="item">777</div>
  </div>
  
</body>
</html>